package com.huitu.whht.base.core.api;

import com.huitu.whht.api.core.common.JerseyConfig.JerseyConfig;
import org.glassfish.jersey.servlet.ServletContainer;
import org.glassfish.jersey.servlet.ServletProperties;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;

@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
@MapperScan({"com.huitu.whht.base.core.api.*.*.dao"})
public class BaseSzyApiApplication {

    public static void main(String[] args) {
        SpringApplication.run(BaseSzyApiApplication.class, args);
    }

    @Bean
    public ServletRegistrationBean jersetServlet() {
        ServletRegistrationBean registration = new ServletRegistrationBean(new ServletContainer(), "/hbszy/*");
        registration.addInitParameter(ServletProperties.JAXRS_APPLICATION_CLASS, JerseyConfig.class.getName());
        registration.setOrder(1);
        registration.setName("hbszy");
        registration.setLoadOnStartup(1);
        return registration;
    }
}
